home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000050_icon-group-sender _Wed Feb 26 08:17:18 1997.msg < prev    next >
Internet Message Format  |  2000-09-20  |  10KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 27 Feb 1997 09:03:58 MST
  2. To: icon-group@cs.arizona.edu
  3. Date: Wed, 26 Feb 1997 08:17:18 -0500
  4. From: Jan Galkowski <jan@solstice.digicomp.com>
  5. Message-Id: <331437DE.41C67EA6@solstice.digicomp.com>
  6. Organization: Digicomp Research Corporation
  7. Sender: icon-group-request@cs.arizona.edu
  8. Subject: Icon and two-dimensional matching
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10. Status: RO
  11. Content-Length: 9732
  12.  
  13. [LONG post warning!]
  14.  
  15. One of the things that strikes me from the partial set of responses
  16. I've gotten regarding my queries "What's the largest Icon program
  17. you've written?" and related, is the extent to which these reported
  18. uses of Icon are examples of "new wines in old bottles".  That is to 
  19. say, the applications remain pretty traditional, although Icon brings
  20. its own means and methods to these problems.
  21.  
  22. Now, I don't in any way want to depreciate or criticize the use or
  23. power of Icon in traditional programming.  Indeed, seeing how 
  24. traditional problems can be addressed by new methods and 
  25. expressive styles is crucial to developing programming itself.
  26. While the conceptual algorithm for expression may be about the
  27. same, the means used to realize it  with the "generate and test" mindset
  28. available in Icon can be dramatically different than in, say, Ada.
  29. Moreover, there are some algorithms which, because of the
  30. availability of Icon's tables, may now be usable and practical
  31. because the effort to use these elements is negligible compared to,
  32. again say, Ada since their one might need to implement the
  33. elements.  It is important to continuously reconsider putting
  34. new wines in "old bottles" if the depth of our collective craft
  35. is to be maintained.
  36.  
  37.  
  38. Still, I wonder if use of Icon would be invigorated if we, collectively,
  39. tried to push it into new areas, ones where it may well have an
  40. edge on traditional software solutions.  For example, the current
  41. (March 1997) issue of _Scientific_ _American_ reports in part
  42. (see pages 54-55) that finding and decoding graphical pictures is
  43. a big part of the technical frontier for Web crawlers.  Putting
  44. aside the extremely thorny problem of dealing with natural
  45. images (the kind off of a camera or TV screen), consider the
  46. set of images which are generated by graphics facilities of 
  47. applications or programming languages such as the graphics
  48. facilities of Icon.  (Professor Griswold and company are
  49. working a book just addressing these facilities.)   Then, 
  50. perhaps, finesse how to get these images into some 
  51. symbolic form and consider the problem of matching patterns
  52. within these images using some two-dimensional analog to
  53. Icon's matching facilities.  What can be developed there?
  54. I think there's a practical motivation, but I suspect in this
  55. initial search it's counterproductive to limit oneself to
  56. just the practical.  Let this be a kind of brain teaser, and
  57. let's leave it as motivated purely for fun.
  58.  
  59. Well, let's consider some of the literature on this.  
  60.  
  61. People have considered various kinds of two dimensional
  62. automata.  These could form the mechanical metaphor for
  63. a two-dimensional scanner.  Basically, the analog to a 
  64. Turing machine of sorts is a scanner which can move at
  65. one step in any of four orthogonal directions, north, south, 
  66. west, or east.  It can tell the state of a cell it is over,
  67. basically what it contains, and it can write into that cell.
  68. It's also possible to "mark" cells with annotations that don't
  69. overwrite their contents.  I recall a good conceptual 
  70. description of such a machine in the second or third edition
  71. of the neat little book _Perceptrons_ by Marvin Minsky and
  72. Seymour Paper, quoting work by Blum, although their interest
  73. is getting at the computational basics of understanding 
  74. natural images.  One could imagine a set of facilities analogous
  75. to Icon's _move_, _tab_, _find_, _match_, "?", and some 
  76. 2D equivalent to csets working in two dimensions, at least
  77. plausibly.
  78.  
  79. Although they don't seem sufficiently powerful to deal with
  80. natural imagery, people have explored various kinds of
  81. 2D grammars.  These are often studied and presented in the
  82. context of production of patterns and textures, but we might
  83. consider them for recognition and parsing.
  84.  
  85. There are, for example, _shape_ _grammars_ proposed by
  86. G.Stiny and J.Gips (_Algorithmic_ _Aesthetics_: _Computer_
  87. _Models_ _for_ _Criticism_ _and_ _Design_ _in_ _the_
  88. _Arts_, University of California Press, Berkeley, 1972, as 
  89. reported in D.Ballard, C.Brown, _Computer_ _Vision_, 1982,
  90. pp. 173-175) which are used to generate textures.
  91.  
  92. There are tree grammars (see S.Y.Lu, K.S.Fu, "A syntactic
  93. approach to texture analysis," _Computer_ _Graphics_ _and_
  94. _Image_ _Processing_, vol. 7, no. 3, June 1978, pp. 303-330,
  95. also summarized in Ballard and Brown, pp. 175-178) which
  96. apply pyramids to the description of tesselations.  Milgram and
  97. Rosenfeld ("Array automata and array grammars", Proceedings,
  98. IFIP Congress 71, Booklet TA-2, Amsterdam: North-Holland, 
  99. 1971, 166-173, also described on pp. 178-181 of Ballard and
  100. Brown) which use two-dimensional "atoms" to generate patterns
  101. from symbols.  (The term "atom" is used in the sense it is in 
  102. LISP, as a basic elementary symbol which cannot be 
  103. deconstructed, at least "using ordinary chemical means".) 
  104.  
  105. Finally, in modeling regions and pictures, Rosenfeld and Kak
  106. give a moderately lengthy and technical presentation on 
  107. grammars in their volume 2 of _Digital_ _Picture_ _Processing_
  108. (Academic Press, 1982, pp. 317-327).
  109.  
  110. A little description of shape grammars will illustrate how this tends
  111. to go:
  112.  
  113. Suppose one is given,
  114.  
  115.     First, a finite set of shapes, Vt.  Members of Vt are "terminal
  116. elements" or basic symbols.
  117.  
  118.     Second, a finite set of symbols, Vm.  Members of Vm are 
  119. "nonterminal shape elements" or markets.  Vm and Vt are
  120. disjoint.
  121.  
  122.     Third, a set Vt+ consisting of elements formed by the "finite
  123. arrangement of one or more elements of Vt in which any elements
  124. and/or their mirror images may be used a multiple number of
  125. times in any location, orientation, or scale" (Ballard, Brown, 
  126. page 173).  This is complicated.  We could just as well enhance
  127. Vt to consist of a basic symbol and basic symbols generated
  128. from that one by rotation, reflection, and scaling.  I like that
  129. way of doing this better.
  130.  
  131.     Fourth, a set Vt* which consists of Vt+ and the empty shape.
  132.  
  133.    Fifth, a set Vm+ defined from Vm in the manner Vt+ is defined
  134. from Vt.  
  135.  
  136.    Sixth, a set Vm* which consists of Vm+ and the empty shape.
  137.  
  138.    Seventh, a finite set R of ordered triples (u,v,w) such that u is
  139. a shape consistning of elements of Vm+, v is an element of
  140. Vt*, and w is an element of Vm*.  Each of these triples is
  141. called a "shape rule" where u is the left side of the rule, 
  142. and v an w together form the right side of the rule. 
  143.  
  144. A texture is generated from a shape grammar by beginning with
  145. some initial shape and repeatedly apply the shape rules wherever
  146. they can be applied.  The elementary step of applying a particular
  147. shape rule (u,v,w) to some shape S is S with the right side (v and w
  148. concatenated) substituted for an occurence in the former S of an
  149. instance of u.
  150.  
  151. The iteration which does this can be sketched:
  152.  
  153.  
  154.    1. Find part of the shape in question which is geometrically
  155.       similar to the left side of a rule in therms of both terminal
  156.       elements and nonterminal elements.  There must be a 
  157.       1-1 correspondence between the terminals and markers
  158.       on the LHS of the rule and the terminals and markers in the
  159.       part of the shape in question to which the rule is to 
  160.       be applied.  Deal with multiple matching rules in some
  161.       way (a conflict resolution strategy), perhaps by letting
  162.       _all_ rules produce daughter shapes concurrently and
  163.       in different contexts.
  164.  
  165.   2. Find the geometric transformations such as scaling, 
  166.      local translation, rotation, reflection which make the LHS
  167.      of the rule identical to the corresponding part in the shape
  168.      in question.
  169.  
  170.  3. Apply these same transformations to the RHS of the 
  171.     matching rule.
  172.  
  173.  4. Substitute the transformed RHS of the rule for the part of
  174.     the shape that corresponds to the LHS of the rule.
  175.  
  176. The generation process terminates when no rule in the grammar
  177. can be applied.
  178.  
  179. Ballard and Brown given an example of how the shape grammar
  180. can generate the hexagonal tesselation of the plane:
  181.  
  182.  
  183.       Vt consists of a single hexagon of a fixed size (for brevity, 
  184.        call this symbol "H")
  185.  
  186.       Vm consists of a single nonterminal, "o", say called a "dot".  
  187.  
  188.       R consists of the rules
  189.  
  190.                              o
  191.             H o --->  H     H  
  192.  
  193.             H o --->  H   o H  
  194.  
  195.             H o --->  H     H o
  196.  
  197.                            o
  198.             H o --->  H     H  
  199.  
  200.             H o --->  H     H  
  201.                              o
  202.  
  203.             H o --->  H     H  
  204.                            o
  205.  
  206.  
  207. where basically one template instance of "H" with a dot 
  208. adjacent produces all configurations of the dot about
  209. the hexagonal element, that is, one placement on each
  210. of its six sides.
  211.  
  212. Recognition of a texture involves deconstruction of the
  213. pattern using the rules in the reverse direction.  If there is
  214. but a single nonterminal left in the procedure, the shape is
  215. said to be recognized, and its identity is given by the
  216. identity of the nonterminal.
  217.  
  218. OK.  So what could be done with Icon?  I'm not at all proposing 
  219. extensions or changes to the language at all.  Let's just consider
  220. it a programming exercise and challenge.  If we wanted to write
  221. Icon programs to parse two dimensional symbol structures, how
  222. would we go about it?   Well, we need to place indices in some
  223. canonical way, and we need to have a means of stepping from
  224. one (i,j) configuration to another.  How do we describe two
  225. dimensional shape patterns?  Suppose, for the moment,  the array
  226.  we want to do matching in can have on ASCII characters
  227. as elements.  Clearly, later we could expand the definition of
  228. csets to contain various graphical elements such as oriented
  229. lines, etc.
  230.  
  231.  Jan Theodore Galkowski,
  232.     Developer, tool & numerical methods elf
  233.  Digicomp Research Corporation,
  234.  Ithaca, NY 14850-5720
  235.  
  236.   jan@digicomp.com
  237.